package com.wk.warehouse.service.impl;

import java.util.HashMap;
import java.util.List;
import com.wk.warehouse.entity.OutStore;
import com.wk.warehouse.mapper.OutStoreMapper;
import com.wk.warehouse.page.Page;
import com.wk.warehouse.service.OutStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class OutStoreServiceImp implements OutStoreService {

	@Autowired
	private OutStoreMapper outStoreMapper;

	/**
	 * 模糊查询条数
	 */
	@Override
	public int selectCount(OutStore outStore) {
		return outStoreMapper.selectCount(outStore);
	}

	/**
	 * 模糊查询数据
	 */
	@Override
	public List<OutStore> selectOutStorePage(OutStore outStore, Page page) {
		HashMap<String, Object> map = new HashMap<>();
		map.put("outStore", outStore);
		map.put("page", page);
		return outStoreMapper.selectOutStorePage(map);
	}

	/**
	 * 用户申请出库
	 */
	@Override
	public int requestOutStore(OutStore outStore){
		return outStoreMapper.addOutstoreRecord(outStore);
	}
	
	@Override
	public int updateStoreNum(OutStore outStore){
		return outStoreMapper.updateStoreNum(outStore);
	}

	/**
	 * 修改出库状态为已出库
	 */
	public int updateOutStoreState(int outsId){
		return outStoreMapper.updateOutStoreState(outsId);
	}
}

